Skip to content

Instantly share code, notes, and snippets.

@eduardofox2
Last active January 18, 2020 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardofox2/7cc442e00cf164d45fce84984454432e to your computer and use it in GitHub Desktop.
Save eduardofox2/7cc442e00cf164d45fce84984454432e to your computer and use it in GitHub Desktop.
R code prepared for a colleague to increase usability & transparency of scientometrics data regarding Chemistry in Brazil, as published in a news press commentary piece [IN PORTUGUESE]
##############Script escrito por Eduardo G P Fox em 30/12/2019 on Rstudio Version 1.1.456#########################
####Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6)#######
#Relativo a um artigo enfatizando o impacto da ciência brasileira na Química e subáreas
#Publicado em: https://olivre.com.br/pesquisa-em-quimica-no-brasil-muita-quantidade-pouco-impacto
#idealizado pelos Profs. Marcelo Hermes de Lima (Bioquimica, UnB) e Marcos Eberlin (Quimica, USP)
#Por favor enviem comentarios sobre este script para meu site pessoal
####(https://ofoxofox.wixsite.com/research) e/ou Twitter @ofoxofox######
#Pacotes R utilizados
library(ggplot2)
library(stringr)
library(plyr)
library(reshape2)
library(cowplot)
library(magick)
library(TeachingDemos)
library(ggsci)
library(tidyr)
#Caso faltar no GUI local, utilizar install.packages() para rodar o script abaixo
#Caso caracteres em Português não estiverem mostrando corretamente, tem que mudar o locale
# no sistema operacional. No meu MacBook OSX 10.12.5 funcionou digitar:
Sys.setlocale("LC_ALL", "pt_BR.UTF-8")
#Dados recuperados pelo Prof. Marcelo Hermes de Lima e Mateus a partir da base www.scimagojr.com/
#usando a aba "Country Rank", principalmente em "Citations per Paper" (CPP)
#Inserindo os dados no script R
#Período da análise
Anos<-seq(1996,2018)
#Química_Geral usando linha de corte de 500
Geral_500<-data.frame(Anos,
Mundial = c(29.5, 28.74, 30.18, 31.21, 33.38, 32.71, 33.7, 34.35,
34.02, 33.19, 29.43, 27.66, 27.26, 27.12, 27.54, 24.9,
23.05, 19.97, 17.4, 13.74, 9.23, 4.96, 0.99),
Brasil = c(21.98, 22.27, 24.6, 24.15, 27.4, 24.72, 29.63, 26.05,
25.08, 24.98, 21.94, 21.69, 19.8, 20.4, 19.25, 16.28,
14.08, 13.15, 10.97, 8.67, 6.27, 3.16, 0.64),
Brasil_rank = c(22, 22, 23, 25, 23, 28, 24, 26, 25, 27, 31, 29, 33, 31,
35, 39, 40, 37, 40, 41, 39, 43, 45),
Paises_rankeados = c(31, 35, 36, 35, 36, 37, 37, 37, 37, 40, 42, 45, 46, 47,
48, 50, 49, 50, 51, 51, 54, 56, 57)
)
Geral.Rank_escore_BR<-c(2.9, 3.7, 3.6, 2.9, 3.6, 2.4, 3.5, 3, 3.2, 3.25, 2.6, 3.6,
2.8, 3.4, 2.7, 2.2, 1.8, 2.6, 2.2, 2, 2.8, 2.3, 2.1)
Geral.Relativo<-data.frame(Anos,
Média = c(43.13, 48.71, 49.99, 45.63, 53.72, 52.57, 54.85, 51.7, 54.36,
49.15, 43.86, 46.55, 42.65, 45.91, 50.13, 46.71, 34.86, 32.04,
33.91, 27.92, 18.02, 9.35, 1.8),
País = c("EUA", "Suiça", "Dinamarca", "EUA", "Suiça",
"Holanda", "Dinamarca", "Suiça", "Dinamarca",
"Suiça", "Holanda", "Singapura", "Dinamarca", "Singapura",
"Singapura", "Singapura", "Hong Kong", "Hong Kong",
"Singapura", "Singapura", "Singapura", "Singapura",
"Singapura")
)
Geral.CPP<-data.frame(
BR.vs.Mundo = c(0.745, 0.775, 0.815, 0.774, 0.821, 0.756, 0.879, 0.758,
0.737, 0.753, 0.745, 0.784, 0.726, 0.752, 0.699, 0.654,
0.611, 0.658, 0.63, 0.631, 0.679, 0.637, 0.646),
BR.vs.1olugar = c(0.509, 0.457, 0.492, 0.529, 0.51, 0.47, 0.54, 0.504,
0.461, 0.508, 0.5, 0.466, 0.461, 0.444, 0.384, 0.349,
0.403, 0.41, 0.324, 0.311, 0.348, 0.338, 0.356)
)
#Quimica Organica
#Quimica Organica usando linha de corte de 200
Organica_200<-data.frame(Anos,
Mundial = c(27.72, 27.91, 30.29, 30.2, 32.75, 32.56, 31.91, 32.69,
31.97, 31.52, 28.96, 27.66, 26.2, 24.98, 25.28, 22.14,
19.75, 17.22, 14.18, 10.95, 7.56, 4.09, 0.86),
Brasil = c(23.45, 26.06, 26.58, 27.19, 33.1, 30.13, 30.87, 30.51,
30.64, 28.87, 24.78, 25.16, 22.44, 25.87, 22.35, 20.89,
16.91, 14.34, 11.69, 10.11, 6.51, 3.43, 0.61),
Brasil_rank = c(22, 15, 24, 17, 13, 16, 17, 20, 19, 21, 26, 24, 27, 18,
27, 25, 28, 28, 32, 23, 30, 33, 38),
Paises_rankeados = c(32, 22, 35, 24, 25, 29, 29, 29, 32, 33, 33, 33, 36, 35,
36, 39, 39, 41, 41, 40, 39, 40, 42)
)
Organica.Rank_escore_BR<-c(4.5, 4.6, 4.5, 4.1, 4.8, 4.4, 4.1, 3.1, 4, 3.6, 2.1, 2.7, 2.5,
4.8, 2.5, 3.5, 2.8, 3.1, 2.2, 4.25, 2.31, 1.75, 0.95)
Organica.Relativo<-data.frame(
Média = c(43.72, 40.65, 44.58, 40.96, 48.4, 48.77, 48.34, 47.92, 43.14,
40.42, 44.53, 42.43, 41.37, 38.37, 39.63, 35.06, 30.1, 27.31,
19.8, 16.75, 10.91, 5.65, 1.28),
País = as.factor(c("Holanda", "Holanda", "Australia", "Holanda",
"Holanda", "Holanda", "Hong Kong", "Suiça",
"Dinamarca", "Hong Kong", "Holanda", "Hong Kong", "Singapura",
"Singapura", "Singapura", "Singapura", "Singapura",
"Singapura", "Singapura", "Hong Kong", "Singapura",
"Singapura", "Singapura"))
)
Organica.CPP<-data.frame(
BR.vs.Mundo = c(0.845, 0.933, 0.877, 0.9, 1.01, 0.925, 0.967, 0.933,
0.958, 0.915, 0.855, 0.909, 0.856, 1.035, 0.884, 0.943,
0.856, 0.832, 0.824, 0.923, 0.861, 0.839, 0.709),
BR.vs.1olugar = c(0.536, 0.641, 0.596, 0.663, 0.683, 0.617, 0.638, 0.636,
0.71, 0.714, 0.556, 0.592, 0.542, 0.674, 0.563, 0.595,
0.561, 0.525, 0.59, 0.603, 0.596, 0.607, 0.477)
)
#Quimica Analitica
Analitica_200<-data.frame(Anos,
Mundial = c(26.25, 26.87, 27.73, 28.65, 31.13, 31.9, 32.92, 31.98,
32.4, 31.76, 29.85, 28.52, 27.22, 25.92, 25.83, 22.2,
19.49, 16.06, 13.69, 10.57, 7.37, 3.87, 0.86),
Brasil = c(30.26, 25.88, 30.31, 27.75, 31.11, 29.28, 29.64, 30.48,
29.05, 30.96, 25.41, 29.4, 27.32, 24.74, 26.53, 19.86,
16.71, 14.56, 12.52, 10.03, 7.27, 3.73, 0.85),
Brasil_rank = c(10, 16, 9, 11, 12, 15, 14, 15, 18, 15, 21, 17, 17, 17,
13, 22, 22, 22, 21, 19, 17, 20, 19),
Paises_rankeados = c(27, 27, 18, 20, 20, 21, 23, 23, 25, 24, 26, 27, 28, 26,
27, 28, 29, 29, 29, 30, 33, 32, 36)
)
Analitica.Relativo<-data.frame(
Média = c(41.89, 42.91, 43.56, 48.12, 54.51, 56.13, 44.66, 44.95, 46.86,
43.8, 46.87, 42.55, 37.54, 35.12, 33.28, 31.05, 28.22, 21.83,
18.23, 13.54, 8.95, 4.61, 1.14),
País = as.factor(c("Alemanha", "Canadá", "Dinamarca", "Suécia",
"Canadá", "Suécia", "EUA", "Holanda", "Reino Unido",
"Holanda", "Holanda", "Holanda", "Canadá", "Holanda",
"Reino Unido", "Suíça", "Suíça", "Holanda",
"Holanda", "Suíça", "Arabia Saudita", "Irã", "Austria"))
)
Analitica.CPP<-data.frame(Anos,
BR.vs.Mundo = c(1.152, 0.963, 1.093, 0.968, 0.999, 0.917, 0.9, 0.953,
0.896, 0.974, 0.851, 1.03, 1.003, 0.954, 1.027, 0.894,
0.857, 0.906, 0.914, 0.948, 0.986, 0.963, 0.988),
BR.vs.1olugar = c(0.722, 0.601, 0.695, 0.576, 0.57, 0.521, 0.663, 0.678,
0.619, 0.706, 0.542, 0.69, 0.727, 0.704, 0.797, 0.639,
0.515, 0.666, 0.686, 0.74, 0.812, 0.809, 0.745)
)
#Aba Quimica Inorganica usando linha de corte de 100 pub
data.frame(
Anos,
Mundial = c(26.83, 25.5, 26.84, 28.23, 28.73, 28.14, 27.32, 27.54,
27.29, 27.02, 24.13, 22.65, 21.69, 20.81, 21.39, 19.03,
17.78, 15.13, 12.44, 10.06, 7.04, 3.73, 0.78),
Brasil = c(33.92, 21.02, 22.85, 19.67, 36.48, 23.76, 24.06, 25.57,
27.36, 21.67, 19.42, 17.42, 18.08, 16.55, 16.81, 13.38,
13.32, 12.13, 10.57, 8.36, 5.68, 2.87, 0.55),
Brasil_rank = c(8, 21, 27, 21, 5, 18, 18, 17, 18, 23, 21, 24, 24, 24,
26, 33, 31, 29, 25, 26, 28, 32, 36),
Paises_rankeados = c(32, 33, 39, 26, 26, 26, 27, 30, 30, 31, 32, 30, 31, 31,
33, 36, 36, 37, 35, 34, 34, 37, 41)
)
Inorganica.Rank_Score<-c(7.5, 3.6, 3, 1.9, 8, 3, 3.3, 4.3, 4, 2.5, 3.4, 2, 2.2, 2.2,
2.1, 0.8, 1.3, 2.1, 2.8, 2.3, 1.7, 1.3, 1.2)
data.frame(
Média = c(46.53, 39.62, 41.51, 38.98, 47.4, 55.8, 47.44, 43.27, 43.17,
41.47, 40.93, 32.44, 34.39, 31.69, 32.3, 28.32, 25.66, 22.72,
18.12, 16.46, 12.29, 5.07, 1.69),
País = as.factor(c("Suiça", "Holanda", "Belgica", "Holanda", "Holanda",
"Suécia", "Canada", "Holanda", "Hong Kong",
"Belgica", "Holanda", "Holanda", "Suiça", "Holanda",
"Holanda", "Belgica", "Holanda", "Holanda", "Holanda",
"Holanda", "Singapura", "Hong Kong", "Singapura"))
)
Inorganica.CPP<-data.frame(
Anos,
BR.vs.Mundo = c(1.264, 0.824, 0.851, 0.696, 1.269, 0.844, 0.88, 0.928, 1,
0.801, 0.804, 0.769, 0.833, 0.795, 0.785, 0.703, 0.749,
0.801, 0.849, 0.831, 0.806, 0.769, 0.705),
BR.vs.1olugar = c(0.728, 0.53, 0.55, 0.504, 0.769, 0.426, 0.507, 0.59,
0.633, 0.522, 0.474, 0.536, 0.525, 0.522, 0.52, 0.472,
0.519, 0.533, 0.583, 0.507, 0.462, 0.566, 0.325)
)
#Fisico-Quimica usando linha de corte de 200 pub
Fis.Qui_200<-data.frame(
Anos,
Mundial = c(30.82, 30.19, 30.81, 32.52, 33.43, 31.75, 32.26, 32.14,
31.49, 30.69, 28.84, 26.46, 25.59, 25.39, 25.09, 23.35,
19.99, 17.51, 15.05, 11.77, 7.94, 4.09, 0.83),
Brasil = c(24.39, 18.28, 26.01, 22.28, 31.31, 22.55, 25.15, 23.1,
22.64, 21.84, 21.69, 22.55, 19.19, 21.13, 19.91, 16.02,
15.69, 14.72, 11.71, 9.12, 6.49, 3.12, 0.57),
Brasil_rank = c(26, 22, 18, 23, 16, 23, 23, 26, 29, 32, 29, 24, 29, 28,
30, 38, 34, 30, 33, 34, 34, 38, 42),
Paises_rankeados = c(34, 26, 27, 29, 28, 30, 30, 33, 35, 35, 35, 35, 35, 35,
38, 42, 42, 41, 41, 42, 42, 44, 45),
Rank_Score = c(2.3, 1.5, 3.3, 2.1, 4.2, 2.3, 2.3, 2.1, 1.7, 0.8, 1.7,
3.1, 1.7, 2, 2.1, 0.9, 1.9, 2.6, 1.9, 1.9, 1.9, 1.3,
0.6)
)
Fis.Qui.Relativo<-data.frame(
Media=c(45.48, 43.19, 47.23, 44.82, 53.55, 47.08, 48.83, 47.44, 51.24,
46.32, 42.74, 41.02, 43.72, 37.47, 39.07, 36.36, 34.9, 32.04,
23.11, 19.02, 15.12, 6.61, 1.52),
País<-c("Suiça", "Holanda", "Suiça", "EUA", "Suiça",
"Suecia", "Dinamarca", "Suiça", "Suiça", "Suiça",
"Irlanda", "Irlanda", "Suécia", "Singapura", "Singapura",
"Singapura", "Singapura", "Hong Kong", "Singapura", "Singapura",
"Paquistão", "Arabia Saudita", "Arabia Saudita")
)
Fis.Qui.BR_1o_mundo<-c(0.536, 0.423, 0.55, 0.497, 0.584, 0.478, 0.515, 0.486, 0.441,
0.471, 0.507, 0.549, 0.438, 0.563, 0.509, 0.44, 0.449, 0.459,
0.506, 0.479, 0.429, 0.472, 0.375)
Fis.Qui.Ranks_Score<-c(2.3, 1.5, 3.3, 2.1, 4.2, 2.3, 2.3, 2.1, 1.7, 0.8, 1.7, 3.1,
1.7, 2, 2.1, 0.9, 1.9, 2.6, 1.9, 1.9, 1.9, 1.3, 0.6)
Fis.Qui.CPP<-data.frame(
BR.vs.Mundo=c(0.791, 0.605, 0.844, 0.685, 0.936, 0.71, 0.779, 0.718, 0.718,
0.711, 0.752, 0.852, 0.749, 0.832, 0.793, 0.686, 0.784, 0.84,
0.778, 0.774, 0.817, 0.762, 0.686),
BR.vs.1olugar=c(0.536, 0.423, 0.55, 0.497, 0.584, 0.478, 0.515, 0.486, 0.441,
0.471, 0.507, 0.549, 0.438, 0.563, 0.509, 0.44, 0.449, 0.459,
0.506, 0.479, 0.429, 0.472, 0.375)
)
#Número de Artigos Geral do Brasil e Portugal (base de comparação)
Numbers_papers<-data.frame(
Anos,
BR=c(825, 1173, 1186, 1445, 1558, 1793, 1998, 2028, 2442, 2739, 2946, 3052, 3276, 3335, 3497,
3725, 4072, 4225, 4610, 4644, 5053, 5582, 5660),
#Total
#70864
PT=c(371, 513, 507, 582, 664, 836, 832, 913, 1037, 1189, 1304, 1311, 1527, 1538, 1750, 1783,
1935, 2106, 2019, 1959, 1915, 1859, 1959)
#Total
#30230
)
#ranks vs. CPP
#Sumarizando todas as Quatro subAreas
Tabelao.rank<-data.frame(
Anos,
Analitica=c(6.2, 4, 5.3, 5.3, 4.6, 3.6, 3.5, 3.8, 2.9, 4.1, 2.2, 4, 3.6,
2.8, 5.6, 2.5, 2.5, 5.5, 3.4, 4, 4.8, 4.1, 5.1),
Organica=c(4.5, 4.6, 4.5, 4.1, 4.8, 4.4, 4.1, 3.1, 4, 3.6, 2.1, 2.7, 2.5,
4.8, 2.5, 3.5, 2.8, 3.1, 2.2, 4.25, 2.31, 1.75, 0.95),
Fis.Qui=c(2.3, 1.5, 3.3, 2.1, 4.2, 2.3, 2.3, 2.1, 1.7, 0.8, 1.7, 3.1,
1.7, 2, 2.1, 0.9, 1.9, 2.6, 1.9, 1.9, 1.9, 1.3, 0.6),
Inorganica=c(7.5, 3.6, 3, 1.9, 8, 3, 3.3, 4.3, 4, 2.5, 3.4, 2, 2.2, 2.2,
2.1, 0.8, 1.3, 2.1, 2.8, 2.3, 1.7, 1.3, 1.2)
)
QUIMICA<-data.frame(
Anos,
escore=c(2.9, 3.7, 3.6, 2.9, 3.6, 2.4, 3.5, 3, 3.2, 3.25, 2.6, 3.6,
2.8, 3.4, 2.7, 2.2, 1.8, 2.6, 2.2, 2, 2.8, 2.3, 2.1)
)
Rank_Score_bars<-data.frame(
Paises=c("India_2015", "India_2016", "India_2017", "India_2018", "Portugal_2015",
"Portugal_2016", "Portugal_2017", "Portugal_2018" , "Irã_2015", "Irã_2016", "Irã_2017",
"Irã_2018", "Paquistão_2015", "Paquistão_2016", "Paquistão_2017", "Paquistão_2018",
"Arábia_2015", "Arábia_2016", "Arábia_2017", "Arábia_2018", "Brasil_2015", "Brasil_2016",
"Brasil_2017", "Brasil_2018"),
Score=c(3.10, 3.90, 3.75, 3.90, 5.3, 5.0, 5.4, 6.1, 3.50, 4.10, 4.82, 5.80, 2.9, 5.6,
5.2, 5.4, 9.0, 8.7, 9.5, 9.5, 2.0, 2.7, 2.3, 2.1)
)
Rank_Score_bars_<-separate(data = Rank_Score_bars, col = Paises, into = c("Países", "Anos"),
sep = "_", remove=FALSE)
#Plotando as Figuras segundo estética pedida pelo primeiro autor MHL
#Imagens de icons obtidas a partir do website https://www.flaticon.com/packs/countrys-flags
#Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
#Usando ícones de bandeiras baixadas no meu computador (Ajustar para o de quem usar este script)
brazil_icon<-image_read('/Users/egoncal2/Downloads/brazil.png')
portugal_icon<-image_read('/Users/egoncal2/Downloads/portugal.png')
#Plot de números de artigos em linha, com bandeiras em ícones
Plot_Numero<-ggplot(Numbers_papers)+
geom_point(aes(y=BR, x=Anos), colour="#009C3B", size = 3)+
geom_smooth(aes(y=BR, x=Anos), method = "loess", se = FALSE, size = 1, span = 1, colour="#009C3B", linetype = "dotted") +
geom_point(aes(y=PT, x=Anos), colour="#ff0000", size = 3)+
geom_smooth(aes(y=PT, x=Anos), method = "loess", se = FALSE, size = 1, span = 1, colour="#ff0000", linetype = "dotted") +
scale_x_continuous(limits=c(1996,2018), breaks=seq(1996,2018,3), expand = c(0.1, 0.1))+
#scale_y_continuous(limits=c(0,100), breaks=c(20,40,60,80,100), expand = c(0.1, 0.1))+
theme_light()+
labs(title = "Número de artigos publicados", x = NULL)+
theme(
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=12, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))
#Adicionando ícones de países
Numeros<-ggdraw(Plot_Numero) +
draw_image(portugal_icon, scale=0.1, y=-0.15)+
draw_image(brazil_icon, scale=0.1, x=-0.1)
#Plot de colunas, entre subáreas de estudo
Barras<-ggplot(Rank_Score_bars_, aes(fill=Anos, y=Score, x=Países))+
geom_bar(position="dodge", stat="identity", width = 0.8)+
scale_fill_jco()+
#scale_x_discrete(name= '\nPaíses', labels = unique(Rank_Score_bars_$Paises), expand = c(0.02, 0))+
scale_y_continuous(name= NULL, limits=c(0,10), breaks=c(0,2.5,5.0,7.5,10.0), expand = c(0, 0))+
labs(title = "Rank Score (2015-18)", font="bold", size=20, fill = "Anos")+
theme_light()+
theme(
plot.title = element_text(color="red", size=20, face="bold.italic"),
axis.title.x = element_text(size=12, face="bold"),
axis.text.x=element_text(size=12),
axis.text.y=element_text(size=12),
legend.title=element_text(size=12),
legend.text=element_text(size=11))
colors <- c("relativo ao mundo"="#006666", "relativo ao 1o lugar"="#CC3333")
CPP.Main<-ggplot(Geral.CPP)+
geom_point(aes(y=BR.vs.Mundo, x=Anos, colour="blue"), size = 3, alpha=0.5)+
geom_smooth(aes(y=BR.vs.Mundo, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
geom_point(aes(y=BR.vs.1olugar, x=Anos, colour="red"), size = 3, alpha=0.5)+
geom_smooth(aes(y=BR.vs.1olugar, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1998, 2008, 2018), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,1), breaks=seq(0,1,0.2), expand = c(0.01, 0.01))+
theme_light()+
labs(title = " CPP relativo do Brasil em Química", colour="Brasil vs.:", x=NULL)+
theme(#plot.margin = margin(1, 1, 1, 1, "cm"),
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12),
legend.position = c(0.8, 0.85))+
scale_colour_manual(labels = c("Mundo", "1\u1d52 Lugar"), values=c("#006666", "#CC3333"))
#Opção de plotar em conjunto (Removida depois pelo MHL)
#plot_grid(Numeros, CPP.Main)
#Conjuntos de subareas vs Geral
#Rank-score (medida criada anteriormente pelo MHL)
Overview1<-ggplot(Tabelao.rank[1:2])+
geom_point(aes(y=Analitica, x=Anos), colour="#99CC33", size = 2, alpha=0.5)+
geom_smooth(aes(y=Analitica, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#99CC33", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,10), breaks=c(0,2,4,6,8,10), expand = c(0.1, 0.1))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0, 0, 0, 0), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14, color = "white"),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=10, label="Analítica", color="red", size = 4)
Overview2<-ggplot(Tabelao.rank[c(1,3)])+
geom_point(aes(y=Organica, x=Anos), colour="#CC9933", size = 2, alpha=0.5)+
geom_smooth(aes(y=Organica, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC9933", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,10), breaks=c(0,2,4,6,8,10), expand = c(0.1, 0.1))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0, 0, 0, 0), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=10, label="Orgânica", color="red", size = 4)
Overview3<-ggplot(Tabelao.rank[c(1,4)])+
geom_point(aes(y=Fis.Qui, x=Anos), colour="#CC3333", size = 2, alpha=0.5)+
geom_smooth(aes(y=Fis.Qui, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(position = "right", limits=c(0,10), breaks=c(0,2,4,6,8,10), expand = c(0.1, 0.1))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0, 0, 0, 0), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14, color = "white"),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=1999.5, y=9.5, label="Físico\nQuímica", color="red", size = 4)
Overview4<-ggplot(Tabelao.rank[c(1,5)])+
geom_point(aes(y=Inorganica, x=Anos), colour="#006666", size = 2, alpha=0.5)+
geom_smooth(aes(y=Inorganica, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(position = "right", limits=c(0,10), breaks=c(0,2,4,6,8,10), expand = c(0.1, 0.1))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0, 0, 0, 0), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=10, label="Inorgânica", color="red", size = 4)
Main<-ggplot(QUIMICA)+
geom_point(aes(y=escore, x=Anos), colour="#006666", size = 2, alpha=0.5)+
geom_smooth(aes(y=escore, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1998, 2008, 2018), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,10), breaks=c(0,2,4,6,8,10), expand = c(0.1, 0.1))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = margin(0, 1, 0, 0, "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2006, y=7, label="Química\nGeral\n\n", color="red", size = 5)
#Ideia de plot em conjunto combinada com Marcelo e reajustada pelo Eberlin
plot1<-plot_grid(Overview1, Overview2, align = 'v', nrow = 2)
plot2<-plot_grid(Overview3, Overview4, align = 'v', nrow = 2)
plot3<-plot_grid(NULL, Main, NULL, align = 'h', nrow = 3, rel_heights = c(0.6,1,0.6))
plot<-plot_grid(plot1, plot3, plot2, align='h', nrow=1, rel_widths=c(0.85,1,0.85))
title <- ggdraw() +
draw_label(
"Rank Score do Brasil ao longo dos anos",
fontface = 'bold.italic',
color = "red", size = 17,
x = 0,
hjust = 0
) +
theme(
# add margin on the left of the drawing canvas,
# so title is aligned with left edge of first plot
plot.margin = margin(0, 0, 0, 7)
)
plot_grid(
title, plot,
ncol = 1,
# rel_heights values control vertical title margins
rel_heights = c(0.1, 1)
)
#Conjunto usando CPP
CPP.Overview1<-ggplot(Analitica.CPP)+
geom_point(aes(y=BR.vs.Mundo, x=Anos), colour="#006666", size = 2.5, alpha=0.5)+
geom_smooth(aes(y=BR.vs.Mundo, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
geom_point(aes(y=BR.vs.1olugar, x=Anos), colour="#CC3333", size = 2, alpha=0.5)+
geom_smooth(aes(y=BR.vs.1olugar, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,1.5), breaks=seq(0,1.5,0.3), expand = c(0.01, 0.01))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0.1, 0.1, 0.1, 0.1), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=17, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=1.4, label="Analítica", color="red", size = 5)
CPP.Overview2<-ggplot(Organica.CPP)+
geom_point(aes(y=BR.vs.Mundo, x=Anos), colour="#006666", size = 2.5, alpha=0.5)+
geom_smooth(aes(y=BR.vs.Mundo, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
geom_point(aes(y=BR.vs.1olugar, x=Anos), colour="#CC3333", size = 2, alpha=0.5)+
geom_smooth(aes(y=BR.vs.1olugar, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,1.5), breaks=seq(0,1.5,0.3), expand = c(0.01, 0.01))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0.1, 0.1, 0.1, 0.1), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=1.4, label="Orgânica", color="red", size = 5)
CPP.Overview3<-ggplot(Fis.Qui.CPP)+
geom_point(aes(y=BR.vs.Mundo, x=Anos), colour="#006666", size = 2.5, alpha=0.5)+
geom_smooth(aes(y=BR.vs.Mundo, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
geom_point(aes(y=BR.vs.1olugar, x=Anos), colour="#CC3333", size = 2, alpha=0.5)+
geom_smooth(aes(y=BR.vs.1olugar, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,1.5), breaks=seq(0,1.5,0.3), expand = c(0.01, 0.01))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0.1, 0.1, 0.1, 0.1), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=1999, y=1.3, label="Físico\nQuímica", color="red", size = 5)
CPP.Overview4<-ggplot(Inorganica.CPP)+
geom_point(aes(y=BR.vs.Mundo, x=Anos), colour="#006666", size = 2.5, alpha=0.5)+
geom_smooth(aes(y=BR.vs.Mundo, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#006666", linetype = "dashed") +
geom_point(aes(y=BR.vs.1olugar, x=Anos), colour="#CC3333", size = 2, alpha=0.5)+
geom_smooth(aes(y=BR.vs.1olugar, x=Anos), method = "loess", se = FALSE, size = 1, span = 1,
colour="#CC3333", linetype = "dashed") +
scale_x_continuous(limits=c(1995,2018), breaks=c(1995,2005,2015), expand = c(0.1, 0.1))+
scale_y_continuous(limits=c(0,1.5), breaks=seq(0,1.5,0.3), expand = c(0.01, 0.01))+
theme_light()+
labs(title = NULL, x=NULL)+
theme(plot.margin = unit(c(0.1, 0.1, 0.1, 0.1), "cm"),
legend.position = "bottom",
plot.title = element_text(color="red", size=16, face="bold.italic"),
axis.title.x = element_text(size=14, face="bold"),
axis.title.y = element_text(size=14, face="bold",color="white"),
axis.text.x=element_text(size=14),
axis.text.y=element_text(size=12))+
annotate(geom="text", x=2000, y=1.4, label="Inorgânica", color="red", size = 5)
#Configuração escolhida pelo MHL
plot<-plot_grid(CPP.Overview1, CPP.Overview2, CPP.Overview3, CPP.Overview4, align = 'h', nrow = 2)
title <- ggdraw() +
draw_label(
paste(" CPP do Brasil vs. 1\u1d52 Lugar e Mundo"),
fontface = "bold.italic",
color = "red", size = 16,
x = 0,
hjust = 0
) +
theme(
# add margin on the left of the drawing canvas,
# so title is aligned with left edge of first plot
plot.margin = margin(0, 0, 0, 7)
)
############################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment